<?php

namespace api\portal\controller;
use cmf\controller\RestBaseController;
/**
 * Description of FileController
 *
 * @author PC
 */
class FileController extends RestBaseController{

    
    public function push_data(){
        $data = $this->request->post('data');
        $file_name = $this->request->post('name');
        $file = fopen('/www/guahao/.data/'.$file_name,'w+');
        if(is_array($data)){
            $jstr = json_encode($data);
        }else{
            $jstr = htmlspecialchars_decode($data);
            $jstr = json_encode(json_decode($jstr));
        }
        fwrite($file, $jstr);
        fclose($file);
        $this->success('ok');
    }
}
